Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> #div1 { position: relative; margin: auto; height: 150px; width: 250px; padding: 10px; border: 1px solid black; -webkit-perspective: 125px; /* Chrome, Safari, Opera */ perspective: 125px; } #div2 { padding: 50px; position: absolute; border: 1px solid black; background-color: coral; -webkit-transform: rotateX(45deg); /* Chrome, Safari, Opera */ transform: rotateX(45deg); } </style> </head> <body> <p>Click the "Try it" button to change the perspecive-origin property of the DIV1 element:</p> <button onclick="myFunction()">Try it</button> <div id="div1">DIV1 <div id="div2">Think that you are a bird, looking down on a wall. Then click the button to see what happens if the wall moves to the left!</div> </div> <script> function myFunction() { document.getElementById("div1").style.WebkitPerspectiveOrigin = "10px 50%"; // Chrome, Safari and Opera document.getElementById("div1").style.perspectiveOrigin = "10px 50%"; } </script> </body> <!-- Mirrored from www.w3schools.com/cssref/tryit.asp?filename=trycss3_js_perspective-origin by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:53:11 GMT --> </html>
Result:
Try it Yourself - © w3schools.com